﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;
using Guru.Web.Controls;
using System.Web.Security;

public partial class MasterPage : HSMMasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {       
        if (!Page.IsPostBack)
        {
            uxMenu.LoadContentFile("~/App_Data/Menu.xml");            
            uxNavigation.LoadContentFile("~/App_Data/Navi.xml");
            this.uxSearchCustomer.OnClientClick = string.Format("javascript:__doPostBack('{0}','')", uxSearchCustomer.UniqueID);
        }

        string urlWithSessionID = Response.ApplyAppPathModifier(Request.Url.PathAndQuery);
        RadTab tab = uxMenu.FindTabByUrl(urlWithSessionID);
        if (tab != null)
        {
            tab.SelectParents();
            tab.Selected = true;
        }
       
    }

    protected void uxSearchCustomer_Click(object sender, EventArgs e)
    {
        HSMSessionManager.CurrentGuestFiltering = this.uxCustomerKey.Text.Trim();
        Response.Redirect("~/FE/Customers.aspx");    
    }

    protected void uxLogout_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Session.Abandon();
        Response.Cookies.Clear();
        FormsAuthentication.SignOut();
        Response.Redirect(this.Page.LoginUrl);
    }
}
